const app = getApp();
const db = wx.cloud.database()
Component({
  options: {
    addGlobalClass: true,
  },
  data: {
    StatusBar: app.globalData.StatusBar,
    CustomBar: app.globalData.CustomBar,
    records:{
      content:"暂无数据",
      imgList:[],
      creater:{
        avatarUrl:"暂无数据",
        name:"暂无数据"
      },
      createTime:'暂无数据'     
    }
  },
  
  methods: {
    isCard: function(e) {
      this.setData({
        isCard:e.detail.value
      })
    }
  },

  lifetimes:{
    attached: function() {
      // 在组件实例进入页面节点树时执行
      
      db.collection(app.globalData.t_record)
      .orderBy('createTime','desc')
      .limit(app.globalData.pageSize)
      .get()
      .then(res=>{
        console.log(res)
        let records = res.data
        
        this.setData({
          records:records
        })
      }).catch(err=>{
        console.error(err)
      }).finally(()=>{
        console.info('finally')
      })
    },
  }
})

